#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
'''
@author: lyndon
@time Created on 2018/9/10 16:24
@desc
'''
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('mysql+mysqldb://root:newpasswd@192.168.100.161:3306/sqlalchemy?charset=utf8')
Base = declarative_base()
print(engine)

class ImdbMove(Base):

    __tablename__ = 'imdb_moves'

    id = Column(Integer, primary_key=True)
    director = Column(String(64))
    rating = Column(String(64))
    title = Column(String(64))
    url = Column(String(1024))

    def __repr__(self):
        """  这个类似java的 toString方法 """
        return '%s(%r)' % (self.__class__.__name__, self.url)

if __name__ == '__main__':
    Base.metadata.create_all(engine)
